/*
 * @Description: 
 * @Author: wangqi
 * @Date: 2021-04-17 12:05:11
 * @LastEditTime: 2021-04-17 12:16:00
 */
class SyncHook {
    constructor(args) {
        this.hooks = [];
    }

    tap(name, task) {
        this.hooks.push(task);
    }

    call(...res) {
        this.hooks.forEach((hook) => {
            hook(...res)
        });
    }

}

let synchook = new SyncHook(['name', 'age']);
synchook.tap('node', (name, age) => {
    console.log('node', name, age)
});

synchook.call('wq', 12);


